<?php
/*
 * @Author: zls 3292844045@qq.com
 * @Date: 2022-05-26 14:05:45
 * @LastEditors: zls 3292844045@qq.com
 * @LastEditTime: 2022-05-26 16:54:06
 * @FilePath: \CUCCL\php\cart.php
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
    include_once('connect.php');

    //接收前端传过来的当前登录账号
    $username = $_GET['username'];

    $sql2 = 'select count(*) as count from cart';
    $data1 = mysqli_query($conn, $sql2);
    $data1 = mysqli_fetch_array($data1);

    $sql = "select * from cart,female_cloths where cart.cloths_id = female_cloths.cloths_id and user_name = '$username'";
    $data = mysqli_query($conn, $sql);
    // $list = [];
    $arr= array();
    $res = [];
    while($info = mysqli_fetch_array($data)){
        // $arr = [];
        // $arr['cart_id'] = $info['cart_id'];
        // $arr['cloths_color'] = $info['cloths_color'];
        // $arr['cloths_id'] = $info['cloths_id'];
        // $arr['cloths_img'] = $info['cloths_img'];
        // $arr['cloths_name'] = $info['cloths_name'];
        // $arr['cloths_prices'] = $info['cloths_prices'];
        // $arr['cloths_type'] = $info['cloths_type'];
        // $arr['num'] = $info['num'];
        // $arr['size'] = $info['size'];
        // $arr['user_name'] = $info['user_name'];
        // array_push($list, $arr);
        $arr[] = $info;
    };
    if($arr){
        $res['status'] = true;
        $res['msg'] = '遍历成功';
        $res['list'] = $arr;
        $res['data1'] = $data1;
    }else{
        $res['status'] = false;
        $res['msg'] = '遍历失败';
        $res['list'] = $arr;
        $res['data1'] = $data1;
    }

   

    echo(json_encode($res));
?>